 package tools.config;

 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.Properties;
 import org.apache.commons.io.FileUtils;










 public class PropertiesUtils
 {
   public static Properties load(String file) throws IOException {
/*  24 */     return load(new File(file));
   }








   public static Properties load(File file) throws IOException {
/*  35 */     FileInputStream fis = new FileInputStream(file);
/*  36 */     BufferedReader buff = new BufferedReader(new InputStreamReader(fis, "gbk"));
/*  37 */     Properties props = new Properties();
/*  38 */     props.load(buff);
/*  39 */     fis.close();
/*  40 */     buff.close();
/*  41 */     return props;
   }








   public static Properties[] load(String... files) throws IOException {
/*  52 */     Properties[] result = new Properties[files.length];
/*  53 */     for (int i = 0; i < result.length; i++) {
/*  54 */       result[i] = load(files[i]);
     }
/*  56 */     return result;
   }








   public static Properties[] load(File... files) throws IOException {
/*  67 */     Properties[] result = new Properties[files.length];
/*  68 */     for (int i = 0; i < result.length; i++) {
/*  69 */       result[i] = load(files[i]);
     }
/*  71 */     return result;
   }








   public static Properties[] loadAllFromDirectory(String dir) throws IOException {
/*  82 */     return loadAllFromDirectory(new File(dir), false);
   }








   public static Properties[] loadAllFromDirectory(File dir) throws IOException {
/*  93 */     return loadAllFromDirectory(dir, false);
   }









   public static Properties[] loadAllFromDirectory(String dir, boolean recursive) throws IOException {
/* 105 */     return loadAllFromDirectory(new File(dir), recursive);
   }









   public static Properties[] loadAllFromDirectory(File dir, boolean recursive) throws IOException {
/* 117 */     Collection<File> files = FileUtils.listFiles(dir, new String[] { "properties" }, recursive);
/* 118 */     return load(files.<File>toArray(new File[files.size()]));
   }








   public static Properties[] overrideProperties(Properties[] initialProperties, Properties[] properties) {
/* 129 */     if (properties != null) {
/* 130 */       for (Properties props : properties) {
/* 131 */         overrideProperties(initialProperties, props);
       }
     }
/* 134 */     return initialProperties;
   }








   public static Properties[] overrideProperties(Properties[] initialProperties, Properties properties) {
/* 145 */     if (properties != null) {
/* 146 */       for (Properties initialProps : initialProperties) {
/* 147 */         initialProps.putAll(properties);
       }
     }
/* 150 */     return initialProperties;
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\config\PropertiesUtils.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */